/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.business.dao.shop;

import com.shop.cereshop.business.page.index.HotSellProduct;
import com.shop.cereshop.business.page.index.UserVisitDTO;
import com.shop.cereshop.business.page.index.VisitCountDTO;
import com.shop.cereshop.business.page.shop.Shop;
import com.shop.cereshop.business.param.business.UpdatePhoneDTO;
import com.shop.cereshop.business.param.logistics.LogistSetDTO;
import com.shop.cereshop.commons.domain.business.CereBusinessShop;
import com.shop.cereshop.commons.domain.shop.CerePlatformShop;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface CerePlatformShopDAO extends BaseMapper<CerePlatformShop> {
    int deleteByPrimaryKey(Long shopId);

    int insertSelective(CerePlatformShop record);

    CerePlatformShop selectByPrimaryKey(Long shopId);

    int updateByPrimaryKeySelective(CerePlatformShop record);

    int updateByPrimaryKey(CerePlatformShop record);

    CerePlatformShop findByShopName(@Param("shopName") String shopName);

    Shop findShop(@Param("shopId") Long shopId);

    void updateState(CerePlatformShop cerePlatformShop);

    Long getTotal(@Param("shopId") Long shopId);

    Long getStayOrders(@Param("shopId") Long shopId);

    Long getStayAfters(@Param("shopId") Long shopId);

    BigDecimal getMoney(@Param("shopId") Long shopId);
    BigDecimal  monthRevenue(@Param("shopId") Long shopId);
    BigDecimal dealMoney(@Param("shopId") Long shopId);
    Integer todayOrders(@Param("shopId") Long shopId);
    Integer  comments(@Param("shopId") Long shopId);
    Long getVisit(@Param("shopId") Long shopId, @Param("startTime") String startTime,
                     @Param("endTime") String endTime);

    /**
     * 根据数据类型条件 获取店铺指定时间访问人数
     */
    Long getVisitByDataType(@Param("shopId") Long shopId, @Param("condition") Integer condition);

    /**
     * 查询店铺指定时间内访问人数
     */
    List<VisitCountDTO> getShopVisitCount(@Param("shopId") Long shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    /**
     * 获取店铺指定时间访问人数
     */
    List<VisitCountDTO> getVisitByTime(@Param("shopId") Long shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    /**
     * 根据时间类型条件 获取店铺指定时间访问人数
     */
    List<VisitCountDTO> getShopVisitCountByTimeType(@Param("shopId") Long shopId, @Param("condition") Integer condition);

    List<HotSellProduct> getHotProducts(@Param("shopId") Long shopId,@Param("condition") Integer condition);

    CerePlatformShop check(@Param("shopPhone") String shopPhone);

    CerePlatformShop findByPhone(@Param("shopPhone") String shopPhone);

    CerePlatformShop checkShopIdByName(@Param("shopName") String shopName,@Param("shopId") Long shopId);

    CerePlatformShop checkShopIdByPhone(@Param("shopPhone") String shopPhone,@Param("shopId") Long shopId);

    BigDecimal findVisits(@Param("shopId") Long shopId,@Param("condition") Integer condition,@Param("type") Integer type);

    /**
     * 根据类型查找店铺转化数据
     */
    List<VisitCountDTO> findShopConversionByType(@Param("shopId") Long shopId, @Param("condition") Integer condition);

    Integer findPayUsers(@Param("productId") Long productId);

    List<CereBusinessShop> findIds();

    Long findShopRoleId(@Param("id") Long id);

    List<CerePlatformShop> selectAll();

    int updatePhone(@Param("updatePhoneDTO") UpdatePhoneDTO updatePhoneDTO);

    String getPhone(@Param("shopId") Long shopId);

    void setLogist(@Param("param") LogistSetDTO param);
}
